#include "sObjectCreator.h"

#include "sObjectLevel.h"
#include "sObjectLabel.h"
#include "sObjectCheckbox.h"

#include "sGUI.h"

namespace sgui
{
    
DEFINE_FABRIC(fbObjectLevel, 
	new res::sObjectLevel(gui, *file.getName())
);
DEFINE_FABRIC(fbObjectLabel, 
	new res::sObjectLabel(gui, *file.getName())
);
DEFINE_FABRIC(fbObjectCheckbox, 
	new res::sObjectCheckbox(gui, *file.getName())
);

// ----------------------------------- fbObject: fabric -------------------------------------
DEFINE_FABRIC_IMPL_BEGIN(fbObjectFabric)

	const std::wstring &name = file.GetAsString();

	std::map<std::wstring, const sNamedObjectFabric*>	m_fabrics;

	m_fabrics.insert(std::pair<std::wstring, const sNamedObjectFabric*>(
        res::sObjectLevel::OBJECT_CLASS, &fbObjectLevel
	));
	m_fabrics.insert(std::pair<std::wstring, const sNamedObjectFabric*>(
		res::sObjectLabel::OBJECT_CLASS, &fbObjectLabel
	));
	m_fabrics.insert(std::pair<std::wstring, const sNamedObjectFabric*>(
		res::sObjectCheckbox::OBJECT_CLASS, &fbObjectCheckbox
	));

	std::map<std::wstring, const sNamedObjectFabric*>::const_iterator ps = m_fabrics.find(name);

	if (ps != m_fabrics.end())
	{
		return ps->second->CreateObject(gui, file);
	}

    return NULL;

DEFINE_FABRIC_IMPL_END(fbObjectFabric);
// -----------------------------------------------------------------------------------------

};